package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealOverViewVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SetmealMapper {
	//@Select("select * from setmeal where id = #{id}")
	SetmealVO getByIdWithDish(Long id);

	Page<SetmealVO> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);

	@AutoFill(value = OperationType.INSERT)
	void save(Setmeal setmeal);

	void deleteByIds(List<Long> ids);

	@AutoFill(value = OperationType.INSERT)
	void update(Setmeal setmeal);

	//@AutoFill(value = OperationType.UPDATE)
	@Update("update setmeal set status = #{status} where id = #{id}")
	void updateStatusById(Integer status, Long id);

	List<SetmealVO> getByCategoryId(Long categoryId);

	@Select("select * from setmeal where id = #{id}")
	Setmeal getById(Long id);

	SetmealOverViewVO queryStatusCount();
}
